/* mmap() replacement for Windows
 *
 * Author: Mike Frysinger <vapier@gentoo.org>
 * Placed into the public domain
 */

/* References:
 * CreateFileMapping: http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx
 * CloseHandle:       http://msdn.microsoft.com/en-us/library/ms724211(VS.85).aspx
 * MapViewOfFile:     http://msdn.microsoft.com/en-us/library/aa366761(VS.85).aspx
 * UnmapViewOfFile:   http://msdn.microsoft.com/en-us/library/aa366882(VS.85).aspx
 */
#ifndef _MMAP_WINDOWS_H_
#define _MMAP_WINDOWS_H_

#ifdef _WIN32

#ifdef __cplusplus
extern "C" {
#endif

#include <sys/types.h>

#define PROT_READ     0x1
#define PROT_WRITE    0x2

#define MAP_SHARED    0x01
#define MAP_PRIVATE   0x02
#define MAP_ANONYMOUS 0x20
#define MAP_ANON      MAP_ANONYMOUS
#define MAP_FAILED    ((void *) -1)

extern void *mmap (void *__addr, size_t __len, int __prot,
		   int __flags, int __fd, off_t __offset);

extern int munmap (void *__addr, size_t __len);

#ifdef __cplusplus
}
#endif

#endif // _WIN32

#endif // _MMAP_WINDOWS_H_
